#include<iostream>
#include<cstring>
class FakeString{
    private:
    static const int CINLIM=10;
    int len;
    char *str;
    public:
    FakeString(){
        // std::cout<<"默认构造函数"<<std::endl;
        len=4;
        str = new char[1];
        str[0]='\0';
    };
    FakeString(const char* s){
        // std::cout<<"有参构造函数"<<std::endl;
        len = std::strlen(s);
        str = new char[len+1];
        std::strncpy(str,s,len);
    }
    FakeString(const FakeString& s){
        // std::cout<<"拷贝构造函数"<<std::endl;
        len =s.len;
        str = new char[len+1];
        std::strncpy(str,s.str,len);

    };
    FakeString(FakeString &&s)noexcept{
        // std::cout<<"移动构造函数"<<std::endl;
        this->str = s.str;
        s.str=nullptr;
        this->len = s.len;
    }

    ~FakeString(){
        // std::cout<<"析构函数"<<std::endl;
        delete [] str;
    };
    int size()const{
        return len;
    }
    void swap(FakeString& rhs){
        using std::swap;
        swap(this->len,rhs.len);
        swap(this->str,rhs.str);

    }
    FakeString & operator =(FakeString st){
        swap(st);
        return *this;

    }
    FakeString& operator = ( char * &s){

        len = std::strlen(s);
        this->str =s;
        s=nullptr;
        return *this;
    }
    friend std::ostream& operator<<(std::ostream& os,const FakeString& s){
        // std::cout<<"重载输出流"<<std::endl;
        os<<s.str;
        return os;
    }
    friend std::istream& operator>>(std::istream &is,FakeString& st){
        char temp[CINLIM];
        is.get(temp,CINLIM);
        // std::cout<<"重载输入流"<<std::endl;
        
        if(is){
            st=temp;
        }
        while(is&&is.get()!='\n') continue;
        return is;
    }


};
void test(){
    using std::cout;
    using std::cin;
    using std::endl;
    FakeString txt;
    cout<<"your input:"<<endl;
    cin>>txt;
    cout<<txt<<endl;
    FakeString str[10];
    char temp[81];
    int i=0;
    int total = 0;
    for(;i<10;++i){
        cout<<i+1<<":";
        cin.get(temp,81);
        if(!cin||cin.get()=='\0') break;
        else{
             str[i]=temp;
             ++total;}
        while(cin&&cin.get()!='\n') continue;
    }
    cout<<endl;
    cout<<"total:"<<total<<endl;
    for(int i=0;i<total;++i){
        cout<<str[i]<<endl;
    }

}
int main(){
    test();
}